package cn.zmit.kuxi.holder;

import com.xdroid.functions.holder.ViewHolderBase;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RelativeLayout;
import android.widget.TextView;
import cn.zmit.kuxi.R;
import cn.zmit.kuxi.entity.HelpEntity;
import cn.zmit.kuxi.interfaces.OnListItemSelectListener;

/** * @author chenxu @parameter  * @return  */
public class HelpCenterHorlder extends ViewHolderBase<HelpEntity> {
	private TextView title;
	private RelativeLayout rlRoot;
	private Context context;
	private static OnListItemSelectListener<HelpEntity>onlistItemSelect;
	@Override
	public View createView(LayoutInflater layoutInflater) {
		// TODO Auto-generated method stub
		context=layoutInflater.getContext();
		View view =layoutInflater.inflate(R.layout.item_help_center, null);
		title=(TextView)view.findViewById(R.id.tv_title);
		rlRoot=(RelativeLayout)view.findViewById(R.id.rlRoot);
		return view;
	}

	@Override
	public void showData(final int position, final HelpEntity itemData) {
		title.setText(itemData.getTitle());
		rlRoot.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				if (onlistItemSelect!=null) {
					onlistItemSelect.onlistItemSelect(position, itemData);
				}
			}
		});
	}
	public static void setOnListItemSelectListener(OnListItemSelectListener<HelpEntity>onListItemSelectListener){
		HelpCenterHorlder.onlistItemSelect=onListItemSelectListener;
	}

}
